// keydown event name -> window
window.addEventListener('keydown', function(event) {
        // 健值 
        let keyCode = event.keyCode;
        // console.log(keyCode);
        // 按键事件的数据 
        let audioEle = document.querySelector(`audio[data-key="${keyCode}"]`);
        // console.log(audioEle);
        if (!audioEle) return;
        audioEle.play();
        let keyEle = document.querySelector(`.key[data-key="${keyCode}"]`);
        if (!keyEle) return;
        keyEle.classList.add('playing');
        // this.setTimeout(function() {
        //     keyEle.classList.remove('playing');
        // }, 100);
        // console.log(keyCode);
    })
    // window.addEventListener('keyup', function() {
    //     let keyCode = event.keyCode;
    //     let keyEle = document.querySelector(`.key[data-key="${keyCode}"]`);
    //     if (!keyEle) return;
    //     keyEle.classList.remove('playing');
    // });
const keys = document.querySelectorAll('.key');
for (let key of keys) {
    // console.log(key);
    key.addEventListener('transitionend', function(event) {
        // key.classList.remove('playing');
        event.target.classList.remove('playing');
    });
}